]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/ParticleEngine.cs
I think bullets come out now.
[rbdr/super-polarity] / Super Polarity / ParticleEngine.cs
index 5cf6bdb2dc7c6215cad1dc8a3d9e30bc6ef0aa34..51188ae3815e1c90c66f34777c31c90063d90d2c 100644 (file)
@@ -11,6 +11,12 @@ namespace SuperPolarity
     {
         private Random random;
         public Vector2 EmitterLocation { get; set; }
+        public Color Color; //TODO: Color list for random colors.
+        public int TTL;
+        public int TTLRandomFactor;
+        public int ScatterFactor;
+        public int ParticleCount;
+        public float StretchFactor;
         private List<Particle> particles;
         private List<Texture2D> textures;
 
@@ -20,6 +26,10 @@ namespace SuperPolarity
             this.textures = textures;
             this.particles = new List<Particle>();
             random = new Random();
+            Color = Color.Red;
+            TTL = 20;
+            TTLRandomFactor = 40;
+            StretchFactor = 1;
         }
 
         private Particle GenerateNewParticle()
@@ -29,15 +39,16 @@ namespace SuperPolarity
             Vector2 velocity = new Vector2(
                 1f * (float)(random.NextDouble() * 2 - 1),
                 1f * (float)(random.NextDouble() * 2 - 1));
+
             float angle = 0;
             float angularVelocity = 0.1f * (float)(random.NextDouble() * 2 - 1);
-            Color color = new Color(
-                (float)random.NextDouble(),
-                (float)random.NextDouble(),
-                (float)random.NextDouble());
-            float size = (float)random.NextDouble();
+            Color color = Color;
+            float size = (float)random.NextDouble() * StretchFactor;
+
+            position.X += random.Next(-ScatterFactor, ScatterFactor);
+            position.Y += random.Next(-ScatterFactor, ScatterFactor);
 
-            int ttl = 20 + random.Next(40);
+            int ttl = TTL + random.Next(TTLRandomFactor);
 
             return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl);
         }